#include "link_stack_simple.h"
#include <stdio.h>
#include <string.h>

#define LEN ((int)(sizeof(story) / sizeof(char *)))

static char *story[] = {
    "从前有座山,",
    "山里有座庙,",
    "庙里有个老和尚在给小和尚讲故事,",
    "讲的什么故事呢？",
};

int main() {
  cstack s = stack_create();

  for (int i = 0; i < 4; i++) {
    stack_push(s, story[i % LEN]);
    printf("Peek: %s\n", stack_peek(s));
  }

  while (!stack_is_empty(s)) {
    printf("pop: %s\n", stack_pop(s));
  }

  for (int i = 0; i < 10; i++) {
    stack_push(s, story[i % LEN]);
    printf("Peek: %s\n", stack_peek(s));
  }

  stack_destory(s);
  return 0;
}